// loading框设置局部刷新，且所有请求完成后关闭loading框
import { ElLoading } from 'element-plus';
import { reactive, ref, unref } from 'vue';
import Request from '@/api/request/request';

export default function loadingDialog(content = '努力加载中...') {
  let loading:any;
  // 打开加载
  function startLoading() {
    loading = ElLoading.service({
      lock: true,
      // spinner: 'refresh',
      customClass: 'create-isLoading', // 自定义加载样式，写在app.vue里面
      background: 'rgba(0, 0, 0, 0.7)',
      text: content,
    });
  }
  // 关闭加载
  function endLoading() {
    if (loading != null) {
      loading.close();
    }
  }
  return {
    startLoading,
    endLoading,
  };
}
